package com.qkl.xiatang.app.utils.appenum;

import lombok.Getter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 喂料状态
 */
@Getter
public enum FeedAllocStatusEnum {

    NOT(0,"未喂料"),
    OK(1,"已喂料"),
    UN_NEED(2,"无需喂料"),
    CANCEL(3,"已取消"),
    ;

    private FeedAllocStatusEnum(Integer status,String name){
        this.status = status;
        this.name = name;
        EnumMap.map.put(status,this);
        EnumMap.list.add(status);
    }

    private Integer status;

    private String name;

    public static boolean isNotStatus(Integer status){
        return NOT == EnumMap.map.get(status);
    }

    public static String getStatusName(Integer status){
        FeedAllocStatusEnum statusEnum = EnumMap.map.get(status);
        return null == statusEnum ? "":statusEnum.getName();
    }

    public static boolean cancelStatus(Integer status){
        if(null == status){
            return false;
        }
        return CANCEL.getStatus().equals(status);
    }


    private static  class EnumMap{
        public static Map<Integer,FeedAllocStatusEnum> map = new HashMap<>();
        public static List<Integer> list = new ArrayList<>();
    }

}
